﻿namespace WatiN.Extensions
{
    public static class Settings
    {
        private static bool assert = true;

        private static BrowserType defaultBrowser = BrowserType.IE;

        private static int waitUntilEnabledTimeout = 2500;

        private static int waitUntilVisibleTimeout = 2500;

        private static int waitTimeout = 2500;

        private static int waitUntilExistsTimeout = 2500;

        private static int maxVisibilitySearchScope = 5;

        /// <summary>
        /// Gets or sets a value indicating whether extension methods should assert element existance or not. Default: true
        /// </summary>
        public static bool Assert
        {
            get
            {
                return assert;
            }

            set
            {
                assert = value;
            }
        }

        public static BrowserType DefaultBrowser
        {
            get
            {
                return defaultBrowser;
            }

            set
            {
                defaultBrowser = value;
            }
        }

        public static int WaitUntilEnabledTimeout
        {
            get
            {
                return waitUntilEnabledTimeout;
            }

            set
            {
                waitUntilEnabledTimeout = value;
            }
        }

        public static int WaitUntilVisibleTimeout
        {
            get
            {
                return waitUntilVisibleTimeout;
            }

            set
            {
                waitUntilVisibleTimeout = value;
            }
        }

        public static int WaitTimeout
        {
            get
            {
                return waitTimeout;
            }

            set
            {
                waitTimeout = value;
            }
        }

        public static int WaitUntilExistsTimeout
        {
            get
            {
                return waitUntilExistsTimeout;
            }

            set
            {
                waitUntilExistsTimeout = value;
            }
        }

        public static bool CreateIEInNewProcess { get; set; }

        public static int MaxVisibilitySearchScope
        {
            get
            {
                return maxVisibilitySearchScope;
            }

            set
            {
                maxVisibilitySearchScope = value;
            }
        }

        public static void Reset()
        {
            Assert = true;
            DefaultBrowser = BrowserType.IE;
            WaitUntilEnabledTimeout = 2500;
            WaitUntilVisibleTimeout = 2500;
            WaitTimeout = 2500;
            WaitUntilExistsTimeout = 2500;
            CreateIEInNewProcess = false;
            MaxVisibilitySearchScope = 5;
        }
    }
}
